<%@page import="model.entity.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Admin</title>

<script type="text/javascript" src="<c:url value="/views/admin/js/jquery-1.4.3.min.js" />"></script>	
<script type="text/javascript" src="<c:url value="/views/admin/js/jquery.tipsy.js"/>"></script>
<script type="text/javascript" src="<c:url value="/views/admin/js/form.js"/>"></script>
<script type="text/javascript" src="<c:url value="/views/admin/js/jquery.pajinate.js"/>"></script>
<script type="text/javascript" src="<c:url value="/views/js/admin/scripts.js"/>"></script>	
<script type="text/javascript" src="<c:url value="/views/admin/js/facebox.js"/>"></script>
<script type="text/javascript" src="<c:url value="/views/admin/js/jquery.validate.js"/>"></script>
    <!-- LOAD FLOT GRAPHS -->
    <script type="text/javascript" src="<c:url value="/views/admin/js/jquery.flot.pack.js"/>"></script>
    <script src="<c:url value="/views/admin/js/graphs.js"/>" type="text/javascript"></script>
    
    <link href="<c:url value="/views/admin/css/styles.css"/>" rel="stylesheet" type="text/css" />
    <link href="<c:url value="/views/admin/css/style.css"/>" rel="stylesheet" type="text/css" />
    <link href="<c:url value="/views/admin/css/stylesvalidation.css"/>" rel="stylesheet" type="text/css" />
     <link href="<c:url value="/views/admin/css/facebox.css"/>" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="header" class="png_bg">

    <div id="head_wrap" class="container_12">
    
        <!-- start of logo - you could replace this with an image of your logo -->
        <div id="logo" class="grid_4">
            <h1><span>
                    <a href="<c:url value="/admin"/>" >
                        Admin
                    </a>
                </span></h1>
        </div>
        <!-- end logo -->
        
        <!-- start control panel -->
    	<div id="controlpanel" class="grid_8">
        
            <ul>
<% 
    if(session.getAttribute("admin")==null )
    {
        RequestDispatcher dispatcher = request.getRequestDispatcher("/views/admin/login.jsp");
        dispatcher.forward(request, response);
    }
    else
    {
        Account acc = (Account)session.getAttribute("admin");
    
%>
<li><p>Signed in as <strong><%= acc.getUsername() %></strong></p></li>
                <li><a  href="<c:url value="/logoutadmin"/>" class="last">Sign Out</a></li>
        <% }%>        
            </ul>
            
        </div>
        <!-- end control panel -->
    
        <!-- start navigation -->
<%
    Object p = request.getAttribute("page") ;
%>
      	<div id="navigation" class=" grid_12">
           
            <ul>
            
                <li><a href="<c:url value="/admin/home"/>" <%= p.toString() == null || p.toString().equals("home.jsp") ? "class='active'" : "" %> >Dashboard</a></li>
                <li><a href="<c:url value="/admin/account"/>" <%= p.toString() !=null && p.toString().equals("account.jsp") || p.toString().equals("newaccount.jsp") ? "class='active'" : "" %>>Users</a></li>
                <li><a href="<c:url value="/admin/product" />"<%= p.toString() !=null && p.toString().equals("product.jsp") || p.toString().equals("createproduct.jsp")|| p.toString().equals("editproduct.jsp") ? "class='active'" : "" %>>Products</a></li>
                <li><a href="<c:url value="/admin/category"/>" <%= p.toString() !=null && p.toString().equals("category.jsp") || p.toString().equals("child.jsp") || p.toString().equals("editcategory.jsp") || p.toString().equals("createcategory.jsp") ? "class='active'" : "" %>>Category</a></li>
                <li><a href="<c:url value="/admin/bill" />"<%= p.toString() !=null && p.toString().equals("bill.jsp") ? "class='active'" : "" %>>Bill</a></li>
                <li><a href="<c:url value="/admin/branch" />" <%= p.toString() !=null && p.toString().equals("branch.jsp") ? "class='active'" : "" %>>Branch</a></li>
                
                
    
            </ul>
          
        </div>
        <!-- end navigation -->
     
    </div><!-- end headwarp  -->
</div><!-- end header -->


<!-- staqrt subnav -->
<div id="sub_nav">

<div id="subnav_wrap" class="container_12">
	
    <!-- start sub nav list -->
    
	<div id="subnav" class=" grid_12">
        <ul>
   
<%
    
if(p == null || p.equals("home.jsp"))
               {
%>
          
<%}
       else if(p.toString().equals("newaccount.jsp") || p.toString().equals("account.jsp") || p.toString().equals("newaccount.jsp") )
            {
%>
            <li>
                <a href="<c:url value="/admin/account"/>" <%= p.toString() !=null && p.toString().equals("account.jsp") ? "class='sub_nav_active'" : "" %> >all account</a>
            </li>
            <li>
                <a href="<c:url value="/admin/account/create"/>" <%= p !=null && p.equals("newaccount.jsp") ? "class='sub_nav_active'" : "class='sub_nav_last'" %> >add new</a>
            </li>
<%}else if(p.toString().equals("product.jsp") || p.toString().equals("createproduct.jsp"))
       {
    %>   
    <li>
        <a href="<c:url value="/admin/product/create"/>" <%= p.toString() !=null && p.toString().equals("createproduct.jsp") ? "class='sub_nav_active'" : "" %> >add product</a>
    </li>
           <%}else if(p.toString().equals("category.jsp") || p.toString().equals("child.jsp") || p.toString().equals("editcategory.jsp") || p.toString().equals("createcategory.jsp") || p.toString().equals("editcategory.jsp"))
                             {
%>
        <li>
                <a href="<c:url value="/admin/category/parent"/>" <%= p.toString() !=null && p.toString().equals("category.jsp") ? "class='sub_nav_active'" : "" %> >Parent</a>
            </li>
            <li>
                <a href="<c:url value="/admin/category/child"/>" <%= p.toString() !=null && p.equals("child.jsp") ? "class='sub_nav_active'" : "" %> >Child</a>
            </li>
            <li>
                <a href="<c:url value="/admin/category/create"/>" <%= p.toString() !=null && p.equals("create.jsp") ? "class='sub_nav_active'" : "class='sub_nav_last'" %> >Create</a>
            </li>
<%}%>
        </ul>
    
    </div>
    <!-- end subnavigation list -->	

</div>


</div>
<!-- end sub_nav -->

<!-- EVERYTING BELOW IS THE MAIN CONTENT -->

<div id="main_content_wrap" class="container_12">

        
    <div class="container_12">

<%
    //String p = String.valueOf(request.getAttribute("page"));
    if(request.getAttribute("page")==null)
    {
    
%>
<jsp:include flush="true" page="views/admin/home.jsp"/>
<%
    }else
    {
%>
<jsp:include flush="true" page="${page}"/>
    </div>
    
       <%}%>    


<div class="clearfix">&nbsp;</div>
<div class="container_12">

   <!-- START FOOTER -->
    
    <div id="footer" class="grid_12">
    
        <p>&copy; Copyright 2013 Your Company | Powered by <a href="#"> Admin</a> | <a href="#">Top</a></p>
        
	</div>
    <!-- END FOOTER -->       
  </div><!-- end content wrap -->

</body>
</html>
